<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016-10-12
 * Time: 13:33
 */

$router->group(['prefix' => 'admin/shop'], function ($router) {
	$router->get('dashboard/{shop_id}', 'DashboardController@index')->name('admin.shop.dashboard');
    $router->get('getMonthData', 'DashboardController@getMonthData')->name('admin.shop.dashboard.getMonthData');
    $router->get('getSelectSeasonData', 'DashboardController@getSelectSeasonData')->name('admin.shop.dashboard.getSelectSeasonData');



	$router->get('list/store', 'StoreController@storeList')->name('admin.shop.list.store');
	$router->get('list/tag', 'StoreController@tagList')->name('admin.shop.list.tag');
	$router->get('list/activity', 'StoreController@activityList')->name('admin.shop.list.activity');
	$router->get('list/city', 'StoreController@cityList')->name('admin.shop.list.city');
	$router->match(['get', 'post'], 'store/system', 'StoreController@system')->name('admin.shop.store.system');
	$router->match(['get', 'post'], 'import', 'StoreController@import')->name('admin.shop.store.import');
	$router->match(['get', 'post'], 'store/search', 'StoreController@search')->name('admin.shop.store.search');
	$router->get('store/point', 'StoreController@point')->name('admin.shop.store.point');
	$router->get('list/store/curd/{id?}', 'StoreController@storeCurd')->name('admin.shop.list.store.curd');
	$router->post('list/store/save', 'StoreController@storeSave')->name('admin.shop.list.store.save');
	$router->get('list/activity/curd/{id?}', 'StoreController@activityCurd')->name('admin.shop.list.activity.curd');
	$router->post('list/activity/save', 'StoreController@activitySave')->name('admin.shop.list.activity.save');
	$router->get('list/tag/curd/{id?}', 'StoreController@tagCurd')->name('admin.shop.list.tag.curd');
	$router->post('list/tag/save', 'StoreController@tagSave')->name('admin.shop.list.tag.save');
	$router->get('list/city/curd/{id?}', 'StoreController@cityCurd')->name('admin.shop.list.city.curd');
	$router->post('list/city/save', 'StoreController@citySave')->name('admin.shop.list.city.save');
	$router->post('store/ajax/storelocator/store/del', 'StoreController@del')->name('store.ajax.del');
	$router->match(['get', 'post'], 'list/activity/select/{id?}', 'StoreController@activitySelect')->name('admin.shop.list.activity.select');

	$router->get('store/clerk/settings', 'ClerkController@settings')->name('admin.shop.clerk.settings');
	$router->get('list/clerk/all', 'ClerkController@lists')->name('admin.shop.store.clerk.all');

	$router->group(['prefix' => 'info', 'middleware' => 'admin.shop_id'], function ($router) {
		$router->group(['prefix' => 'clerk/manage'], function ($router) {

			$router->get('store/clerk/all', 'ClerkController@lists')->name('admin.shop.clerk.all');

			$router->get('list', 'ClerkController@index')->name('admin.shop.clerk.list');

			$router->get('create', 'ClerkController@create')->name('admin.shop.clerk.create');

			$router->get('edit/{clerk_id}', 'ClerkController@edit')->name('admin.shop.clerk.edit');

			$router->post('update/{clerk_id}', 'ClerkController@update')->name('admin.shop.clerk.update');

			$router->post('store', 'ClerkController@store')->name('admin.shop.clerk.store');

			$router->get('toggleStatus', 'ClerkController@toggleStatus')->name('admin.shop.clerk.status');
		});

		$router->group(['prefix' => 'order'], function ($router) {

			$router->get('/', 'OrderController@index')->name('admin.shop.order.index');
			$router->get('show/{id}', 'OrderController@show')->name('admin.shop.order.show');
		});

		$router->group(['prefix' => 'refund'], function ($router) {
			$router->get('/', 'RefundController@index')->name('admin.shop.refund.index');
			$router->get('show/{id}', 'RefundController@show')->name('admin.shop.refund.show');
		});

		$router->group(['prefix' => 'users'], function ($router) {

			$router->get('/', 'UserController@index')->name('admin.shop.user.index');
		});

		//商品管理
		$router->group(['prefix' => 'goods'], function ($router) {
			$router->get('/', 'GoodsController@index')->name('admin.shop.goods.index');
			$router->get("/editGoods", "GoodsController@editGoods")->name('admin.shop.goods.editGoods');
			$router->post("/saveGoods", "GoodsController@saveGoods")->name('admin.shop.goods.saveGoods');
			$router->get("/editBatchGoods", "GoodsController@editBatchGoods")->name('admin.shop.goods.editBatchGoods');
			$router->post("/saveBatchGoods", "GoodsController@saveBatchGoods")->name('admin.shop.goods.saveBatchGoods');

            $router->get("pointDeductionSetting", "GoodsController@pointDeductionSetting")->name('admin.shop.goods.pointDeductionSetting');
            $router->post("savePointDeductionSetting", "GoodsController@savePointDeductionSetting")->name('admin.shop.goods.savePointDeductionSetting');
		});

		/**
		 * 品牌
		 */
		$router->group(['prefix' => 'brand'], function ($router) {
			$router->get('/', 'BrandController@index')->name('admin.shop.brand.index');
			$router->get('create', 'BrandController@create')->name('admin.shop.brand.create');
			$router->get('edit/{id}', 'BrandController@edit')->name('admin.shop.brand.edit');

			$router->post("store", "BrandController@store")->name('admin.shop.brand.store');
		});
	});

	//新促销活动
	$router->group(['prefix' => 'discount', 'namespace' => 'Promotion'], function () use ($router) {
		$router->get('/', 'DiscountController@index')->name('admin.shop.promotion.discount.index');
		$router->get('create', 'DiscountController@create')->name('admin.shop.promotion.discount.create');
		$router->get('edit/{id}', 'DiscountController@edit')->name('admin.shop.promotion.discount.edit');
		$router->post('store', 'DiscountController@store')->name('admin.shop.promotion.discount.store');
		$router->get('useRecord', 'DiscountController@useRecord')->name('admin.shop.promotion.discount.useRecord');
		$router->get('getUsedExportData', 'DiscountController@getUsedExportData')->name('admin.shop.promotion.discount.getUsedExportData');
	});

	//新促销优惠券
	$router->group(['prefix' => 'coupon', 'namespace' => 'Promotion'], function () use ($router) {
		$router->get('/', 'CouponController@index')->name('admin.shop.promotion.coupon.index');
		$router->get('create', 'CouponController@create')->name('admin.shop.promotion.coupon.create');
		$router->get('edit/{id}', 'CouponController@edit')->name('admin.shop.promotion.coupon.edit');
		$router->post('store', 'CouponController@store')->name('admin.shop.promotion.coupon.store');
		$router->get('useRecord', 'CouponController@useRecord')->name('admin.shop.promotion.coupon.useRecord');
		$router->get('show', 'CouponController@showCoupons')->name('admin.shop.promotion.coupon.show');
		$router->get('sendCoupon', 'CouponController@sendCoupon')->name('admin.shop.promotion.coupon.sendCoupon');
		$router->get('filterUser', 'CouponController@filterUser')->name('admin.shop.promotion.coupon.sendCoupon.filterUser');
		$router->post('getUsers', 'CouponController@getUsers')->name('admin.shop.promotion.coupon.getUsers');
		$router->post('getSelectedUsersByID', 'CouponController@getSelectedUsersByID')->name('admin.promotion.coupon.getSelectedUsersByID');
		$router->post('sendAction', 'CouponController@sendAction')->name('admin.shop.promotion.coupon.sendAction');
		$router->get('couponCode', 'CouponController@couponCode')->name('admin.shop.promotion.coupon.couponCode');
		$router->post('createCouponCode', 'CouponController@createCouponCode')->name('admin.shop.promotion.coupon.createCouponCode');
		$router->get('getExportData', 'CouponController@getExportData')->name('admin.shop.promotion.coupon.getExportData');
		$router->get('getUsedExportData', 'CouponController@getUsedExportData')->name('admin.shop.promotion.coupon.getUsedExportData');
		$router->get('getCouponsExportData', 'CouponController@getCouponsExportData')->name('admin.shop.promotion.coupon.getCouponsExportData');
	});

	$router->group(['prefix' => 'pubic', 'namespace' => 'Promotion'], function () use ($router) {
		$router->get('getSpu', 'PublicController@getSpu')->name('admin.shop.promotion.getSpu');
		$router->get('getShop', 'PublicController@getShop')->name('admin.shop.promotion.getShop');
		$router->post('getSpuData', 'PublicController@getSpuData')->name('admin.shop.promotion.getSpuData');
		$router->post('getShopData', 'PublicController@getShopData')->name('admin.shop.promotion.getShopData');
		$router->post('export/excelExport', 'PublicController@excelExport')->name('admin.shop.promotion.excelExport');
		$router->get('export/download/{url}', 'PublicController@download')->name('admin.shop.promotion.download');
	});

    // 定向发券
    $router->group(['prefix' => 'directional/coupon'], function () use ($router) {

        $router->get('/', 'DirectionalCouponController@index')->name('admin.promotion.directional.coupon.index');

        $router->get('/create', 'DirectionalCouponController@create')->name('admin.promotion.directional.coupon.create');

        $router->post('/store', 'DirectionalCouponController@store')->name('admin.promotion.directional.coupon.store');

        $router->get('/api/coupon', 'DirectionalCouponController@coupon_api')->name('admin.promotion.directional.coupon.api.coupon');

        $router->post('/searchUser', 'DirectionalCouponController@searchUser')->name('admin.promotion.directional.searchUser');

        $router->post('/delete', 'DirectionalCouponController@destroy')->name('admin.promotion.directional.delete');

        $router->post('/retry', 'DirectionalCouponController@retry')->name('admin.promotion.directional.retry');

        $router->get('/{id}/edit', 'DirectionalCouponController@edit')->name('admin.promotion.directional.edit');

        $router->get('/{id}/log', 'DirectionalCouponController@log')->name('admin.promotion.directional.log');
    });
});

$router->group(['prefix' => 'admin/report', 'middleware' => 'admin.shop_id'], function ($router) {
	/**
	 * 采购、采购退货报表
	 */
	$router->get('purchase', 'PurchaseReportController@index')->name('admin.shop.report.purchase');
	$router->get('purchaseDetailListSum', 'PurchaseReportController@purchaseDetailListSum')->name('admin.shop.report.purchase.purchaseDetailListSum');
	$router->get('purchaseDetailList', 'PurchaseReportController@purchaseDetailList')->name('admin.shop.report.purchase.purchaseDetailList');
	$router->get('purchaseGroupByHandlerList', 'PurchaseReportController@purchaseGroupByHandlerList')->name('admin.shop.report.purchase.purchaseGroupByHandlerList');
	$router->get('purchaseGroupBySkuList', 'PurchaseReportController@purchaseGroupBySkuList')->name('admin.shop.report.purchase.purchaseGroupBySkuList');
	$router->get('purchaseGroupByGoodList', 'PurchaseReportController@purchaseGroupByGoodList')->name('admin.shop.report.purchase.purchaseGroupByGoodList');
	$router->get('purchaseGroupByOrderList', 'PurchaseReportController@purchaseGroupByOrderList')->name('admin.shop.report.purchase.purchaseGroupByOrderList');
	$router->get('purchaseDetailListExcel', 'PurchaseReportController@purchaseDetailListExcel')->name('admin.shop.report.purchase.purchaseDetailListExcel');

	/**
	 * 销售报表
	 */
	$router->get('sales', 'SalesReportController@index')->name('admin.shop.report.sales');
	$router->get('saleDetailListSum', 'SalesReportController@saleDetailListSum')->name('admin.shop.report.sales.saleDetailListSum');
	$router->get('saleDetailList', 'SalesReportController@saleDetailList')->name('admin.shop.report.sales.saleDetailList');
	$router->get('saleGroupBySkuList', 'SalesReportController@saleGroupBySkuList')->name('admin.shop.report.sales.saleGroupBySkuList');
	$router->get('saleGroupByGoodList', 'SalesReportController@saleGroupByGoodList')->name('admin.shop.report.sales.saleGroupByGoodList');
	$router->get('saleGroupByOrderList', 'SalesReportController@saleGroupByOrderList')->name('admin.shop.report.sales.saleGroupByOrderList');
	$router->get('saleGroupByClientList', 'SalesReportController@saleGroupByClientList')->name('admin.shop.report.sales.saleGroupByClientList');
	$router->get('saleGroupBySalerList', 'SalesReportController@saleGroupBySalerList')->name('admin.shop.report.sales.saleGroupBySalerList');
	$router->get('saleGroupByComStoreList', 'SalesReportController@saleGroupByComStoreList')->name('admin.shop.report.sales.saleGroupByComStoreList');
	$router->get('saleDetailListExcel', 'SalesReportController@saleDetailListExcel')->name('admin.shop.report.sales.saleDetailListExcel');

	/**
	 * 盘点报表
	 */
	$router->get('stock', 'TakeStockReportController@index')->name('admin.shop.report.take.stock');
	$router->get('storeRecordDetailList', 'TakeStockReportController@storeRecordDetailList')->name('admin.shop.report.take.stock.storeRecordDetailList');
	$router->get('storeRecordGroupByOrderList', 'TakeStockReportController@storeRecordGroupByOrderList')->name('admin.shop.report.take.stock.storeRecordGroupByOrderList');
	$router->get('storeRecordGroupByGoodList', 'TakeStockReportController@storeRecordGroupByGoodList')->name('admin.shop.report.take.stock.storeRecordGroupByGoodList');
	$router->get('storeRecordDetailListSum', 'TakeStockReportController@storeRecordDetailListSum')->name('admin.shop.report.take.stock.storeRecordDetailListSum');
	$router->get('storeDetailListExcel', 'TakeStockReportController@storeDetailListExcel')->name('admin.shop.report.take.stock.storeDetailListExcel');

	/**
	 * 调拨报表
	 */
	$router->get('allot', 'AllotReportController@index')->name('admin.shop.report.allot');
	$router->get('ransfersRecordDetailListSum', 'AllotReportController@ransfersRecordDetailListSum')->name('admin.shop.report.allot.ransfersRecordDetailListSum');
	$router->get('transfersRecordDetailList', 'AllotReportController@transfersRecordDetailList')->name('admin.shop.report.allot.transfersRecordDetailList');
	$router->get('transfersRecordList', 'AllotReportController@transfersRecordList')->name('admin.shop.report.allot.transfersRecordList');
	$router->get('transfersGoodsList', 'AllotReportController@transfersGoodsList')->name('admin.shop.report.allot.transfersGoodsList');
	$router->get('transfersStorehouseList', 'AllotReportController@transfersStorehouseList')->name('admin.shop.report.allot.transfersStorehouseList');
});

$router->group(['prefix' => 'admin/warehouse', 'middleware' => 'admin.shop_id'], function ($router) {
	/**
	 * 库存盘点
	 */
	$router->group(['prefix' => 'take/stock'], function ($router) {
	    $router->group(['prefix'=>'plan'],function($router){
            $router->get('/', 'TakeStockPlanController@index')->name('admin.shop.take.stock.plan');
            $router->get('create', 'TakeStockPlanController@create')->name('admin.shop.take.stock.plan.create');
            $router->post('store', 'TakeStockPlanController@store')->name('admin.shop.take.stock.plan.store');

            $router->get('storeItemsModal', 'TakeStockPlanController@storeItemsModal')->name('admin.shop.take.stock.plan.storeItemsModal');
            $router->get('storeItems', 'TakeStockPlanController@storeItems')->name('admin.shop.take.stock.plan.storeItems');

            $router->post('changeStatus', 'TakeStockPlanController@changeStatus')->name('admin.shop.take.stock.plan.changeStatus');

            $router->get('show/{id}', 'TakeStockPlanController@show')->name('admin.shop.take.stock.plan.show');
            $router->get('getExportData', 'TakeStockPlanController@getExportData')->name('admin.shop.take.stock.plan.getExportData');

        });


		$router->get('/', 'TakeStockController@index')->name('admin.shop.take.stock.index');
		$router->get('create', 'TakeStockController@create')->name('admin.shop.take.stock.create');
		$router->post('store', 'TakeStockController@store')->name('admin.shop.take.stock.store');
		$router->get('show/{id}', 'TakeStockController@show')->name('admin.shop.take.stock.show');

		$router->get('reviewTakeModal', 'TakeStockController@reviewTakeModal')->name('admin.shop.take.stock.reviewTakeModal');
		$router->get('reviewTake', 'TakeStockController@reviewTake')->name('admin.shop.take.stock.reviewTake');
	});

	/**
	 * 入库操作
	 */
	$router->group(['prefix' => 'purchase'], function ($router) {
		$router->get('/', 'PurchaseController@index')->name('admin.shop.purchase.index');
		$router->get('show', 'PurchaseController@show')->name('admin.shop.purchase.show');
		$router->get('create', 'PurchaseController@create')->name('admin.shop.purchase.create');
		$router->post('store', 'PurchaseController@store')->name('admin.shop.purchase.store');

		$router->group(['prefix' => 'importStock'], function ($router) {
			$router->get('/', 'ImportStockController@index')->name('admin.shop.importStock.index');
			$router->get('importStockModal', 'ImportStockController@importStockModal')->name('admin.shop.importStock.importStockModal');
			$router->get('getImportDataCount', 'ImportStockController@getImportDataCount')->name('admin.shop.importStock.getImportDataCount');
			$router->get('saveImportData', 'ImportStockController@saveImportData')->name('admin.shop.importStock.saveImportData');
		});
		
	});

	/**
	 * 退货操作
	 */
	$router->group(['prefix' => 'reject'], function ($router) {
		$router->get('/', 'PurchaseRejectController@index')->name('admin.shop.reject.index');
		$router->get('show', 'PurchaseRejectController@show')->name('admin.shop.reject.show');
		$router->get('create', 'PurchaseRejectController@create')->name('admin.shop.reject.create');
	});

	/**
	 * 调拨操作
	 */
	$router->group(['prefix' => 'transfer'], function ($router) {
		$router->get('/', 'TransferController@index')->name('admin.shop.transfer.index');
		$router->get('show', 'TransferController@show')->name('admin.shop.transfer.show');
		$router->get('create', 'TransferController@create')->name('admin.shop.transfer.create');
		$router->post('store', 'TransferController@store')->name('admin.shop.transfer.store');
	});

	/**
	 * 库存流水
	 */
	$router->group(['prefix' => 'record'], function ($router) {
		$router->get('/', 'StockRecordController@index')->name('admin.shop.record.index');
		$router->post('goodsStoredRecordList', 'StockRecordController@goodsStoredRecordList')->name('admin.shop.record.goodsStoredRecordList');
	});

	/**
	 * 库存查询
	 */
	$router->group(['prefix' => 'stock/query'], function ($router) {
		$router->get('/', 'StockQueryController@index')->name('admin.shop.stock.query.index');
		$router->get('getGoodsStoredSumData', 'StockQueryController@getGoodsStoredSumData')->name('admin.shop.stock.query.getGoodsStoredSumData');
		$router->get('getGoodsStoredList', 'StockQueryController@getGoodsStoredList')->name('admin.shop.stock.query.getGoodsStoredList');
		$router->get('getGoodsSkuStoredList', 'StockQueryController@getGoodsSkuStoredList')->name('admin.shop.stock.query.getGoodsSkuStoredList');
		$router->get('getPhotosByGoodsId', 'StockQueryController@getPhotosByGoodsId')->name('admin.shop.stock.query.getPhotosByGoodsId');

		$router->get('getExportData', 'StockQueryController@getExportData')->name('admin.shop.goods.getExportData');

		$router->get('importStock', 'StockImportController@index')->name('admin.shop.goods.importStock');
		$router->get('importStockModal', 'StockImportController@importStockModal')->name('admin.shop.goods.importStockModal');
		$router->get('getImportDataCount', 'StockImportController@getImportDataCount')->name('admin.shop.goods.getImportDataCount');
		$router->get('saveImportData', 'StockImportController@saveImportData')->name('admin.shop.goods.saveImportData');

		$router->get('fixStoreNum', 'ImportStockController@fixStoreNum')->name('admin.shop.goods.fixStoreNum');

	
	});

	$router->group(['prefix' => 'public'], function ($router) {
		$router->get('goodsSelect', 'PublicController@goodsSelect')->name('admin.shop.public.goodsSelect');
		$router->get('getStoredCount', 'PublicController@getStoredCount')->name('admin.shop.public.getStoredCount');
	});

});



